package cn.pugle.base.bitbyte;

/**
 * @author tzp
 * @since 2020/11/3
 */
public class FormatBBTest {
    public static void main(String[] args) {
        intTest();
    }

    public static void intTest() {
        int i = 0x80000000;
        int j = 0x7FFFFFFF;
        System.out.println(i);
        System.out.println(i - 1);
        System.out.println(j);
        System.out.println(-j);
        System.out.printf("%02x\n", -j);
        System.out.printf("%02x\n", 1);
        System.out.printf("%02x\n", -1);//正数的原码即为其补码，负数的补码是上面取得的反码加1
        System.out.println("------------");
        System.out.printf("%02x\n", Byte.MAX_VALUE);//byte 1个字节, 8bit, 16进制就是2位咯

        byte b = 0x11;
        System.out.printf("b: %08x\n", b);
        int a = b;
        System.out.printf("(int)b:%08x\n", a);
        System.out.printf("15:%08x\n", 15);
        System.out.println(b & 15);
    }
}
